const { DataTypes } = require("sequelize");
const sequelize = require("./index");

const ProductImage = sequelize.define("product_image", {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        allowNull: false,
        autoIncrement: true,
    },
    url: {
        type: DataTypes.TEXT,
        allowNull: false,
    },
    productId: {
        type: DataTypes.INTEGER,
        allowNull: false,
    }
},{
    timestamps: false
});

ProductImage.associate = function ({
    Product,
                           }) {
    ProductImage.belongsTo(Product)
};

module.exports = ProductImage;
